{% if rec and rec.extinfo %}

{% if 'def_profile' in rec.extinfo and rec.extinfo['def_profile'] != '' %}

<img src="{{ rec.extinfo['def_profile'] }}"  style=" border: 1px solid #ddd" class="img-thumbnail">
{% else %}
    {% if 'def_gender' in rec.extinfo %}
        {% if rec.extinfo['def_gender'] == 'Male'%}
            <img src="{{ static_url('tass/images/nan.png') }}" class="img-thumbnail">
        {% elif rec.extinfo['def_gender'] == 'Female' %}
            <img src="{{ static_url('tass/images/nv.png') }}"   class="img-thumbnail">
        {% else %}
            <img src="{{ static_url('tass/images/none.png') }}"   class="img-thumbnail">
        {% end %}
    {% else %}
        <img src="{{ static_url('tass/images/none.png') }}"   class="img-thumbnail">
    {% end %}
{% end %}
{% else %}
 <img src="{{ static_url('tass/images/none.png') }}"   class="img-thumbnail">
{% end %}